﻿using System;

namespace ch02.binary
{
    public enum ValType
    {
        ValTypeI32 = 0x7F, // i32
        ValTypeI64 = 0x7E, // i64
        ValTypeF32 = 0x7D, // f32
        ValTypeF64 = 0x7C // f64
    }

    public static class Types
    {
        internal static string ValTypeToStr(ValType vt)
        {
            return vt switch
            {
                ValType.ValTypeI32 => "i32",
                ValType.ValTypeI64 => "i64",
                ValType.ValTypeF32 => "f32",
                ValType.ValTypeF64 => "f64",
                _ => throw new Exception("invalid valtype: " + vt)
            };
        }
    }
}